
<?php foreach($more_todos as $todo) {?>
<tr>
	<td width="2%" <?php if(($todo->priority=="high")){echo 'class="priority_high"' ;}elseif(($todo->priority=="medium")){echo 'class="priority_medium"';}elseif(($todo ->priority=="low")){ echo 'class="priority_low"';}else{ echo 'class="priority_none"';} ?>>
		<?php if($todo->is_completed == 0) {?>
			<a href="<?php echo site_url('user/to_do/complete/'.$todo->id.'/'.date('d').'/'.date('m').'/'.date('y'));?>"><i class="icon-ok-circle muted"></i></a>
					 <?php }else {?>
					 <a href="<?php echo site_url('user/to_do/incomplete/'.$todo->id);?>"><i class="icon-ok-sign text-success"></i></a>
					 <?php }?>
					 <span <?php if($todo->is_completed == 1) {?> style="text-decoration: line-through;" <?php } ?>>
					 <td width="88%">
					 <a class="text-info"><?php echo $todo->des;?></a></span>
				</td>
	<td width="3%">		<?php if($todo->is_fav == 1) {?>	
					<a href="#" rel="<?php  echo site_url("user/to_do/rem_fav/".date('m')."/".date('y'))?>" onclick="rem_fav(<?php echo $todo->id?>,<?php echo date('d');?>,this.rel)"><i class="icon-star"></i></a> 
					<?php } ?>					
				</td>
	<td width="7%">
					<div class="dropdown">
  <a class="dropdown-toggle" data-toggle="dropdown" href="#"><i class="icon-cogs"></i>
  <b class="caret"></b>
  </a>
					<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
						
						<?php if(!$this->ion_auth->is_admin($this->session->userdata('user_id'))){?> 
					 	<li><a href="<?php echo site_url('user/to_do/worksheet/'.$todo->id);?>" class="add_worksheets"><i class="icon-plus text-error"></i> <span class="text-error"> Add To Worksheet</span> </a></li>
						<?php }?>
						<?php if($todo->is_fav == 0){ ?>
						<li><a href="javascript:void(0)" onclick="add_fav(<?php echo $todo->id?>)"><i class="icon-star"></i> Add to Fav </a></li>
						<?php }?>
						<li><a href="<?php echo site_url('user/to_do/get_todo/'.$todo->id);?>" class="get_todos"><i class="icon-edit"></i> Edit ToDo </a></li>	
						<!--<li><a href="javascript:void(0)" onclick="send_todo(<?php echo $todo->id?>)"><i class="icon-edit"></i> Edit ToDo </a></li>	-->
						<li><a href="javascript:void(0)" onclick="delete_todo(<?php echo $todo->id?>)"><i class="icon-trash"></i> Delete </a></li>
					 </ul>
					</div>
					</td>
</tr>
<?php }?>

<?php foreach($todos_not_dated as $todos) {?>
<tr>
	<td width="2%" <?php if(($todos->priority=="high")){echo 'class="priority_high"' ;}elseif(($todos->priority=="medium")){echo 'class="priority_medium"';}elseif(($todos ->priority=="low")){ echo 'class="priority_low"';}else{ echo 'class="priority_none"';} ?>>
		<?php if($todos->is_completed == 0) {?>
			<a href="<?php echo site_url('user/to_do/complete/'.$todos->id.'/'.date('d').'/'.date('m').'/'.date('y'));?>"><i class="icon-ok-circle muted"></i></a>
					 <?php }else {?>
					 <a href="<?php echo site_url('user/to_do/incomplete/'.$todos->id);?>"><i class="icon-ok-sign text-success"></i></a>
					 <?php }?>
					 <span <?php if($todos->is_completed == 1) {?> style="text-decoration: line-through;" <?php } ?>>
					 <td width="88%">
					 <a class="text-info"><?php echo $todos->des;?></a></span>
					 
				</td>
	<td width="3%">	
	<?php if($todos->is_fav == 1) {?>		
					<a href="#" rel="<?php  echo site_url("user/to_do/rem_fav/".date('m')."/".date('y'))?>" onclick="rem_fav(<?php echo $todos->id?>,<?php echo date('d');?>,this.rel)"><i class="icon-star"></i></a> 
			<?php } ?>								
				</td>
	<td width="7%">
					<div class="dropdown">
  <a class="dropdown-toggle" data-toggle="dropdown" href="#"><i class="icon-cogs"></i>
  <b class="caret"></b>
  </a>
					<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
						
						<?php if(!$this->ion_auth->is_admin($this->session->userdata('user_id'))){?> 
					 	<li><a href="<?php echo site_url('user/to_do/worksheet/'.$todos->id);?>" class="add_worksheets"><i class="icon-plus text-error"></i> <span class="text-error"> Add To Worksheet</span> </a></li>
						<?php }?>
						<?php if($todos->is_fav == 0){ ?>
						<li><a href="javascript:void(0)" onclick="add_fav(<?php echo $todos->id?>)"><i class="icon-star"></i> Add to Fav </a></li>
						<?php }?>
						<li><a href="<?php echo site_url('user/to_do/get_todo/'.$todos->id);?>" class="get_todos"><i class="icon-edit"></i> Edit ToDo </a></li>	
					
						<li><a href="javascript:void(0)" onclick="delete_todo(<?php echo $todos->id?>)"><i class="icon-trash"></i> Delete </a></li>
					 </ul>
					</div>
					</td>
</tr>
<?php }?>

<!--previous month todo fetch starts-->
				<?php $pre_todos = $this->user_model->previous_todo($userid);
				foreach($pre_todos as $pt){	
				if( ($i == date('d') AND $month_id == date('m') AND $year_id == date('y'))){ ?>
				<tr>
				<td width="3%" <?php if(($pt->priority=="high")){echo 'class="priority_high"' ;}elseif(($pt->priority=="medium")){echo 'class="priority_medium"';}elseif(($pt->priority=="low")){ echo 'class="priority_low"';}else{ echo 'class="priority_none"';} ?>>
					<?php if($pt->is_completed == 0) {?>
					 <a href="<?php echo site_url('user/to_do/complete/'.$pt->id.'/'.$i.'/'.$month_id.'/'.$year_id);?>"><i class="icon-ok-circle muted"></i></a>
					 <?php }else {?>
					 <a href="<?php echo site_url('user/to_do/incomplete/'.$pt->id);?>"><i class="icon-ok-sign text-success"></i></a>
					 <?php }?>
				</td>
					<td width="87%" <?php if(($i == $pt->date_id)){ echo 'class="text-info" title="Todays Todo" ';}else{echo 'class="text-warning" title="Forwarded Todo" ';} ?> >
					<span <?php if($pt->is_completed == 1) {?>
					style="text-decoration: line-through;"					
					<?php }?> >  <?php echo $pt->des?>
						</span>
					</td>
					<td width="3%">			
					<a href="javascript:void(0)" onclick="rem_fav(<?php echo $pt->id?>,<?php echo $i;?>)"><i class="icon-star"></i></a> 					
				</td>
					<td width="7%">
					<div class="dropdown">
  <a class="dropdown-toggle" data-toggle="dropdown" href="#"><i class="icon-cogs"></i>
  <b class="caret"></b>
  </a>
					<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">						
						<?php if(!$this->ion_auth->is_admin($this->session->userdata('user_id'))){?> 
					 	<li><a href="<?php echo site_url('user/to_do/worksheet/'.$pt->id);?>" class="add_worksheet"><i class="icon-plus text-error"></i> <span class="text-error"> Add To Worksheet</span> </a></li>
						<?php }?>						
						<li><a href="<?php echo site_url('user/to_do/get_todo/'.$pt->id);?>" class="get_todo"><i class="icon-edit"></i> Edit ToDo </a></li>	
						<li><a href="javascript:void(0)" onclick="delete_todo(<?php echo $pt->id?>)"><i class="icon-trash"></i> Delete </a></li>
					 </ul>
					</div>						
					</td>
				</tr>
				<?php }}?>
				<!--previous month todo fetch ends-->





<script>
	$('.add_worksheets').click(function(event) {	
  event.preventDefault();
  $.get(this.href, function(html) {
  $(html).appendTo('body').modal(); 
  });
});
	
$('.get_todos').click(function(event) { 
  event.preventDefault();
  $.get(this.href, function(html) {
  $(html).appendTo('body').modal(); 
  });
});	
</script>
